import java.util.Scanner;
public class GuessNumber {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        boolean d = false;
        String again = "y";
        while (again .equals("y")||again .equals("Y")) {
            int sjs = (int) ((Math.random() * 100) + 1);
            System.out.println("请输入您猜的数:");
        for (int i = 0; i < 7; i++) {
            int c = sc.nextInt();
            if (c < sjs) {
                System.out.println("您的数猜小了！");
            } else if (c > sjs) {
                System.out.println("您的数猜大了！");
            }else{
            d = true;
            break;
        }
    }
            if (d == true) {
        System.out.println("恭喜您猜对了！");
    }else {
        System.out.println("游戏失败！");
    }
            System.out.println("是否继续? 请输入(Y/N)");
        again = sc.next();
            while (!again.equals("Y") && !again.equals("y") && !again.equals("n") && !again.equals("N")){
        System.out.println("输入错误，请重新输入：");
      again = sc.next();
    }
}
        System.out.println("再见！");

    }
}

